<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Title</title>
    <script src="https://cdn.staticfile.net/jquery/3.7.1/jquery.js"></script>
  </head>
  <body>
    <div class="title">
      <button id="getbtn">get</button>
      <button id="postbtn">post</button>
      <button id="getJsonp">Jsonp</button>
    </div>
  </body>
  <script>
    $(function () {
      $("#getbtn").click(() => {
        $.ajax({
          type: "GET",
          url: "http://127.0.0.1/api/getApi",
          success: function (res) {
            console.log(res);
          },
        });
      });
      $("#postbtn").click(() => {
        $.ajax({
          type: "POST",
          url: "http://127.0.0.1/api/postApi",
          data: { 项目: "xxxx", 背景: "xxx", 联系方式: "xxxxx" },
          success: function (res) {
            console.log(res);
          },
        });
      });

      $("#getJsonp").click(() => {
        $.ajax({
          type: "GET",
          url: "http://127.0.0.1/api/jsonp",
          dataType: "jsonp",
          success: function (res) {
            console.log(res);
          },
        });
      });
    });
  </script>
</html>
